package com.qf.java2102.qihaonan.hotel.service.impl;

import com.qf.java2102.qihaonan.hotel.dao.IFoodDao;
import com.qf.java2102.qihaonan.hotel.dao.impl.FoodDaoImpl;
import com.qf.java2102.qihaonan.hotel.entity.ResultVO;
import com.qf.java2102.qihaonan.hotel.pojo.Food;
import com.qf.java2102.qihaonan.hotel.service.IFoodService;
import com.qf.java2102.qihaonan.hotel.utils.JdbcUtils;


/**
 * @author qhn
 * @version 1.0
 */
public class FoodServiceImpl implements IFoodService {

    private IFoodDao foodDao = new FoodDaoImpl();

    @Override
    public ResultVO<Food> findById(Long foodId) {
        try {
            return ResultVO.ok("查询菜品数据成功", foodDao.findById(foodId));
        } catch (Exception e){
            e.printStackTrace();
        } finally {
            JdbcUtils.release(JdbcUtils.getConnection());
        }
        return ResultVO.error("查询菜品失败");
    }
}
